<?php
/**
 * @Name: UsersRoleModel.php
 * @Author: yashuai<1762910894@qq.com>
 */

namespace app\common\model\rbac;

use app\common\model\BaseModel;

class UsersRoleModel extends BaseModel
{

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'ID';

    /**
     * 数据表名
     * @var string
     */
    protected $table = 'db_admin_user_role';

    /**
     * @Desc 关联角色
     * @return \think\model\relation\HasOne
     * @author yashuai<1762910894@qq.com>
     */
    public function role()
    {
        return $this->hasOne(RoleModel::class, 'RoleID', 'RoleID')
            ->field(['RoleID', 'RoleName', 'RoleDesc']);
    }
}
